package top.jiangqiang.qyblog.core.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import top.jiangqiang.qyblog.core.base.entity.BaseEntity;
import top.jiangqiang.qyblog.core.handler.JacksonTypeHandler;

import java.io.Serial;
import java.time.LocalDateTime;
import java.util.Map;

/**
 * <p>
 * 文章
 * </p>
 *
 * @author JiangQiang
 * @since 2023-05-29
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "qy_article", autoResultMap = true)
@Schema(name = "文章")
public class Article extends BaseEntity {
    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "文章标题")
    private String title;

    @Schema(description = "文章概要，用于文章列表处显示")
    private String abstractContent;

    @Schema(description = "文章别名，用于拼接该文章详情页的访问地址")
    private String alias;

    @Schema(description = "文章封面图片地址")
    private String coverUrl;

    @Schema(description = "markdown格式的文章内容")
    private String content;

    @Schema(description = "文章额外配置，例如附件列表")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, Object> metadata;

    @Schema(description = "文章发布时间", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime publishTime;

    @Schema(description = "文章排序")
    private Integer sort = 0;

    @Schema(description = "文章状态，1：未发布 2：已发布")
    private Integer status;
}
